package com.next

class OpportunityHistory
{
    String serialNumber
    //商机号

    Double amount = 0

    Double probability = 0

    OpportunityStatus status

    String memo

    OpportunityStage stage
    OpportunityType type
    OpportunitySubtype subtype

    PurchasingMethod purchasingMethod

    LeadSource source

    Territory territory

    ProductLine productLine
    Product product

    Date startTime
    Date endTime

    Lead lead

    CauseOfFailure causeOfFailure
    //失败原因
    String descriptionOfFailure
    //失败原因说明

    String externalId

    Contract contract

    User createBy
    User user

    Date createdDate

    Account account
    Campaign campaign

    Date externalModifiedDate
    //外部修改时间

    Opportunity parent

    static constraints = {
        campaign nullable: true, blank: true
        contract nullable: true, blank: true
        createdDate nullable: true, blank: true
        descriptionOfFailure nullable: true, blank: true, type: "text"
        endTime nullable: true, blank: true
        externalId nullable: true, blank: true //, unique: true
        externalModifiedDate nullable: true, blank: true
        lead nullable: true, blank: true
        memo nullable: true, blank: true
        serialNumber nullable: true, blank: true
        stage nullable: true, blank: true
        startTime nullable: true, blank: true
        subtype nullable: true, blank: true
        territory nullable: true, blank: true
        type nullable: true, blank: true
        source nullable: true, blank: true
        causeOfFailure nullable: true, blank: true
        createBy nullable: true, blank: true
        user nullable: true, blank: true
        productLine nullable: true, blank: true
        product nullable: true, blank: true
        purchasingMethod nullable: true, blank: true
    }

    static mapping = {
        sort 'createdDate': 'desc'
    }

    String toString()
    {
        serialNumber
    }
}
